<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2022/9/24
  Time: 14:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="page/head.jsp"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <form method="post" action="/emp?method=addEmp">
                <div class="form-group">
                    <label for="ename">员工名</label>
                    <input type="text" class="form-control" name="ename" id="ename" placeholder="员工名">
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" class="form-control" name="pwd" id="password" placeholder="密码">
                </div>
                <div class="form-group">
                    <label>性别</label>
                    <label class="radio-inline">
                        <input type="radio" name="esex" id="inlineRadio1" value="男" checked> 男
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="esex" id="inlineRadio2" value="女"> 女
                    </label>
                </div>
                <div class="form-group">
                    <label for="salary">工资</label>
                    <input type="number" class="form-control" name="salary" id="salary" placeholder="工资">
                </div>
                <div class="form-group">
                    <label>部门</label>
                    <select class="form-control" name="dno" id="dno">
                    </select>
                </div>
                <div class="form-group">
                    <label for="bornDate">出生日期</label>
                    <input type="date" class="form-control" name="born_date" id="bornDate" >
                </div>
                <button type="submit" class="btn btn-default">新增</button>
            </form>
        </div>
    </div>
</div>
<script>
    $(function () {
        $.ajax({
            url:"/dept?method=getAll",
            type:"get",
            dataType:"json",
            success:function (result) {
                for (let x in result){
                    $("#dno").append("<option value = '"+result[x].dno+"'>" + result[x].dname + "</option>")
                }
            }
        })
    })
</script>
</body>
</html>
